<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

    <title>Include Custom Fonts</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <link href="../../stylesheet.css" type="text/css" rel="stylesheet"/>
<link href="../../page_styles1.css" type="text/css" rel="stylesheet"/>

  


<link href="../../calibreHtmlOutBasicCss.css" type="text/css" rel="stylesheet" />

</head>
<body>

<div class="calibreMeta">
  <div class="calibreMetaTitle">
  
  
    
    <h1>
      <a href="../../../index.html">Sigil User Guide
</a>
    </h1>
    
    
  
  </div>
  <div class="calibreMetaAuthor">
    0.7.2

  </div>
</div>

<div class="calibreMain">

  <div class="calibreEbookContent">
    
      <div class="calibreEbNavTop">
        
          <a href="tutorial_stylesheets.html" class="calibreAPrev">previous page</a>
        

        
          <a href="tutorial_advanced_find.html" class="calibreANext"> next page</a>
        
      </div>
    

    
  <h2 id="fonts" class="calibre5">Include Custom Fonts</h2>

  <p class="h2subheading">— Embedding Fonts In Your Book —</p>

  <p class="calibre1">This tutorial shows you how to use custom fonts in your EPUB.</p>

  <div class="tip">
    <p class="tiptext">One of the benefits of ereaders is that you can choose your own font, so it’s usually best to only use embedded fonts to highlight specific types of text – such as chapter headings, quotes, etc. – and not to change the font of the entire book.</p>
  </div>

  <p class="calibre1">To use a font in an EPUB you need to load the font into the EPUB, define a style for the font, and then apply the style to your text.</p>

  <div class="tip">
    <p class="tiptext">You will need to know about stylesheets to embed fonts so you should read through the <a href="../Text/tutorial_stylesheets.html">Stylesheets</a> chapter first.</p>
  </div>

  <h3 class="sigilnotintoc">Adding Fonts to your EPUB</h3>

  <p class="calibre1">To add fonts to your book, use the Add Existing Files button <img alt="document-add_22px" src="../Images/document-add_22px.png" class="calibre7"/>. This will display a dialog allowing you to select one or more files from your computer. Select as many font files as you want.</p>

  <div class="tip">
    <p class="tiptext">Many fonts are not free. Before you include fonts in your EPUB please make sure that you have a license or permission to use them. There are many free fonts available online if you search for them.</p>

    <p class="tiptext">Fonts files must be either OpenType (<span class="example2">.otf</span>) or TrueType (<span class="example2">.ttf</span>) format. All ereaders should support <span class="example2">otf</span> but most will likely support both formats.</p>
  </div>

  <p class="calibre1">The fonts will be added to the Fonts folder in the Book Browser. However, they are not yet actually used anywhere in your book – they are just available to use.</p>

  <h3 class="sigilnotintoc" id="inserting_images">Defining Styles for Your Font</h3>

  <p class="calibre1">Once the fonts are in your EPUB, you must define a style that includes them.</p>

  <p class="calibre1">Add or open a stylesheet that is linked to your HTML files (see the <a href="../Text/tutorial_stylesheets.html">Stylesheets</a> chapter for more details).</p>

  <p class="calibre1">Add a definition of the font, e.g.:</p>
  <pre class="example1">@font-face {
    font-family: 'Garamond';
    font-weight: normal;
    font-style: normal;
    src: url('../Fonts/Garamond.ttf');
}

@font-face {
    font-family: 'Garamond';
    font-weight: bold;
    font-style: normal;
    src: url('../Fonts/Garamond Bold.ttf');
}

@font-face {
    font-family: 'Garamond ;
    font-weight: normal;
    font-style: italic;
    src: url('../Fonts/Garamond Italic.ttf');
}</pre>

  <div class="tip">
    <p class="tiptext">Font names are case-sensitive!</p>

    <p class="tiptext">You must define one @font-face rule for each style of font (normal, bold, italics, etc.).</p>

    <p class="tiptext">When using the name of a font-family the font name must either be quoted or unquoted every time you use it – you cannot mix quoted and unquoted names. Always using quotes around the font name makes things more consistent and avoids having to check if a name is valid without quotes.</p>
  </div>

  <p class="calibre1">The font still isn’t actually being used in the book yet, that’s the next step.</p>

  <h3 class="sigilnotintoc">Apply Your Font to Text</h3>

  <p class="calibre1">To make use of the font you need to create another style that you will then assign to sections of your text.</p>

  <p class="calibre1">So, for example, to use your new font for headings, define the style for the heading tag as follows:</p>
  <pre class="example1">h1 { 
    font-family: 'Garamond', serif;
}</pre>

  <p class="calibre1">Or to certain paragraphs:</p>
  <pre class="example1">p.longhand { 
    font-family: 'Garamond', serif;
    font-style: italic;
}</pre>

  <p class="calibre1">Or if you want, although it’s not recommended, you can apply the font to all text in the book:</p>
  <pre class="example1">body { 
    font-family: 'Garamond', serif;
    font-weight: bold;
}</pre>

  <div class="tip">
    <p class="tiptext">The font-family rules above instruct the ereader to use your font if possible for the text, but if it’s not possible use a generic serif font.</p>
  </div>

  <h3 class="sigilnotintoc">Font Obfuscation</h3>

  <p class="calibre1">When you use a font in an EPUB, the font file could be extracted by someone and used somewhere else. If your fonts are licensed you may want to prevent this.</p>

  <p class="calibre1">You can use Sigil’s font obfuscation menu to scramble the font file using one of two standard methods, Adobe or IDPF – which one is up to you, but you should test on your target ereader to make sure the font is still readable. Obfuscation is not encryption – it just modifies the font file making it hard to use elsewhere while still being useable by readers to display fonts.</p>

  <p class="calibre1">To use font obfuscation, right-click on your fonts in the Book Browser window, right-click and select Font Obfuscation from the menu and choose a method to use for obfuscation.</p>

  <div class="image"><img alt="tutorial-font-obfuscate" src="../Images/tutorial-font-obfuscate.png" class="calibre7"/></div>

  <h3 class="sigilnotintoc">Testing Your Font</h3>

  <p class="calibre1">Not all devices will show embedded fonts. Even Sigil may not show all your embedded fonts. Its best to test on your target device to check if your fonts are displayed as you expect.</p>



  </div>

  
  <div class="calibreToc">
    <h2><a href="../../../index.html"> Table of contents</a></h2>
     <div>
  <ul>
    <li>
      <a href="cover_picture.html">Cover</a>
    </li>
    <li>
      <a href="titlepage.html">Title Page</a>
    </li>
    <li>
      <a href="rights.html">Copyright</a>
    </li>
    <li>
      <a href="introduction.html">Introduction</a>
      <ul>
        <li>
          <a href="whats_new.html">What’s New</a>
        </li>
        <li>
          <a href="about_sigil.html">About Sigil</a>
        </li>
        <li>
          <a href="about_epub.html">About EPUB</a>
        </li>
      </ul>
    </li>
    <li>
      <a href="installation.html">Installation</a>
    </li>
    <li>
      <a href="features.html">Features</a>
      <ul>
        <li>
          <a href="user_interface.html">User Interface</a>
        </li>
        <li>
          <a href="preferences.html">Preferences</a>
        </li>
        <li>
          <a href="opening_and_saving_files.html">Opening and Saving Files</a>
        </li>
        <li>
          <a href="book_view.html">Book View</a>
        </li>
        <li>
          <a href="code_view.html">Code View</a>
        </li>
        <li>
          <a href="preview.html">Preview</a>
        </li>
        <li>
          <a href="book_browser.html">Book Browser</a>
        </li>
        <li>
          <a href="metadata.html">Metadata</a>
        </li>
        <li>
          <a href="add_cover.html">Add Cover</a>
        </li>
        <li>
          <a href="table_of_contents.html">Table of Contents</a>
        </li>
        <li>
          <a href="validation.html">Validation</a>
        </li>
        <li>
          <a href="spellcheck.html">Spellcheck</a>
        </li>
        <li>
          <a href="media_files.html">Images, Video, Audio</a>
        </li>
        <li>
          <a href="special_characters.html">Special Characters</a>
        </li>
        <li>
          <a href="splitting_and_merging.html">Splitting and Merging</a>
        </li>
        <li>
          <a href="find_replace.html">Find &amp; Replace</a>
        </li>
        <li>
          <a href="saved_searches.html">Saved Searches</a>
        </li>
        <li>
          <a href="clips.html">Clips</a>
        </li>
        <li>
          <a href="clipboard_history.html">Clipboard History</a>
        </li>
        <li>
          <a href="links.html">Links and IDs</a>
        </li>
        <li>
          <a href="styles.html">Styles</a>
        </li>
        <li>
          <a href="indexes.html">Indexes</a>
        </li>
        <li>
          <a href="reports.html">Reports</a>
        </li>
        <li>
          <a href="external_editors.html">External Editors</a>
        </li>
      </ul>
    </li>
    <li>
      <a href="tutorials.html">Tutorials</a>
      <ul>
        <li>
          <a href="tutorial_getting_started_with_epub.html">Getting Started With EPUB</a>
        </li>
        <li>
          <a href="tutorial_convert_to_html.html">Prepare Your File For Sigil</a>
        </li>
        <li>
          <a href="tutorial_load_file.html">Open Your File With Sigil</a>
        </li>
        <li>
          <a href="tutorial_save.html">Save Your EPUB File</a>
        </li>
        <li>
          <a href="tutorial_metadata.html">Add the Author and Title</a>
        </li>
        <li>
          <a href="tutorial_add_cover.html">Add a Cover Image</a>
        </li>
        <li>
          <a href="tutorial_split.html">Create Files For Each Chapter</a>
        </li>
        <li>
          <a href="tutorial_mark_chapters.html">Identify Your Chapters</a>
        </li>
        <li>
          <a href="tutorial_generate_toc.html">Generate A Table of Contents</a>
        </li>
        <li>
          <a href="tutorial_links.html">Create Links and Notes</a>
        </li>
        <li>
          <a href="tutorial_code_view.html">A Quick Introduction To Code View</a>
        </li>
        <li>
          <a href="tutorial_spelling.html">Check For Spelling Mistakes</a>
        </li>
        <li>
          <a href="tutorial_validate.html">Check For Errors In Your EPUB</a>
        </li>
        <li>
          <a href="tutorial_find_replace.html">Edit With Find &amp; Replace</a>
        </li>
        <li>
          <a href="tutorial_stylesheets.html">Use Stylesheets</a>
        </li>
        <li>
          <a href="tutorial_embed_fonts.html">Include Custom Fonts</a>
        </li>
        <li>
          <a href="tutorial_advanced_find.html">Advanced Find &amp; Replace – Regex</a>
        </li>
        <li>
          <a href="tutorial_regex_reference.html">Regular Expression Reference</a>
        </li>
        <li>
          <a href="tutorial_tips.html">Tips</a>
        </li>
      </ul>
    </li>
    <li>
      <a href="faq.html">FAQ</a>
      <ul>
        <li>
          <a href="faq.html#faq_common_questions">Common Questions</a>
        </li>
        <li>
          <a href="faq.html#faq_questions">Where to Get Help</a>
        </li>
        <li>
          <a href="faq.html#faq_using_sigil">Using Sigil</a>
        </li>
        <li>
          <a href="faq.html#faq_formatting">Formatting and Styles</a>
        </li>
      </ul>
    </li>
    <li>
      <a href="contributing_to_sigil.html">Contributing to Sigil</a>
    </li>
  </ul>
</div>


  </div>
  

  <div class="calibreEbNav">
    
      <a href="tutorial_stylesheets.html" class="calibreAPrev">previous page</a>
    

    <a href="../../../index.html" class="calibreAHome"> start</a>

    
      <a href="tutorial_advanced_find.html" class="calibreANext"> next page</a>
    
  </div>

</div>

</body>
</html>
